In database systems, to query a database, a query is issued. A query is normally encoded in a query language, such as Structured Query Language (“SQL”). If a query is for data from more than one table, or selected as a function of data stored in one or more tables other than a table data is to be selected from, one or more table joins need to be made. The majority of joins between tables are equijoins. An equijoin is where the column(s) in one table are equal to the column(s) in one or more other tables.
There exist for some database management systems, such as database management systems available from Teradata, query generator tools. These tools receive as input, database table-column pairs for data a user wishes to obtain from the database. The query generator builds a query to fulfill the users request and typically returns a SQL statement string. To build the query statement, the query generator access metadata that describes the database. The metadata may include data to make equijoins between tables.
However, occasionally a join between two tables involves operators other than equals. Such joins are most common between date and date/time columns. Joins of this type are referred to as non-equijoins. Query generators to date have been unable to make non-equijoins by reading the underlying metadata. Working around this limitation requires additional programming effort when using query generators when a non-equijoin is required in a query.